<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Album extends Controller {
    
    //保存数据
    public function action_saveInfo(){

        $id=$this->request->post('model_id');

        $userid=$this->request->post('userid');

        $caption=$this->request->post('caption');

        $special=$this->request->post('special');

        $isdisabled=$this->request->post('isdisabled');

        $model_post=new Model_Admin_Post();

        echo $model_post->saveAlbumInfo($id,$userid,$caption,$special,$isdisabled);
    }
    //删除数据
    public function action_deleteInfo(){

        $id=$this->request->post('id');

        $Model_Admin=new Model_Admin_Common();

        echo $Model_Admin->deleteInfo("album",$id);

    }
    //根据id加载数据
    public function action_loadInfoById(){

        $id=$this->request->post('id');
        $sql="select t.albumid model_id,
        t.caption,t.userid,t.isdisabled
            from album t
            where t.albumid='$id'
            limit 1";

        $Model_Admin=new Model_Admin_Common();
        
        echo $Model_Admin->loadInfoById($sql);
    }

    //根据id加载数据
    public function action_loadInfoByUserId(){

        $id=$this->request->post('userid');
        $sql="select t.albumid id,t.caption
            from album t
            where t.userid='$id'
            and isdisabled<>'1'";

        $Model_Admin=new Model_Admin_Common();
        
        echo $Model_Admin->loadInfoById($sql);
    }
}
?>